package com.ext.array;

import java.util.Arrays;

public class ArrayDemo2 {
    public static void main(String[] args) {
        int[][] array = new int[3][4];
//        System.out.println(Arrays.toString(array));
        // 二维数组动态初始化,第二个中括号可以为空，第一个中括号必须不为空
        int[][] arr = new int[3][];
        System.out.println(Arrays.toString(arr));
        arr[0] = new int[3];
        System.out.println(Arrays.toString(arr[0]));
        arr[1] = new int[5];
        arr[2] = new int[6];
        for (int i = 0; i < arr.length; i++) {
            for (int j = 0; j < arr[i].length; j++) {
                arr[i][j] = i + j;
            }
        }
        // 输出二维数组 deepToString方法
        System.out.println(Arrays.deepToString(arr));
    }
}
